package com.music.service.albums.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Required;

import com.music.service.albums.beans.Album;
import com.music.service.albums.dao.AlbumDAO;
import com.music.service.albums.exceptions.AlbumPermissionDeniedException;

public class AlbumServiceImpl implements AlbumService {
	private AlbumDAO mAlbumDAO;

	/**
	 * @return the albumDAO
	 */
	public AlbumDAO getAlbumDAO() {
		return mAlbumDAO;
	}

	/**
	 * @param pAlbumDAO the albumDAO to set
	 */
	@Required
	public void setAlbumDAO(AlbumDAO pAlbumDAO) {
		mAlbumDAO = pAlbumDAO;
	}

	public boolean addNewAlbum(Long pMemberId, String pAlbumName) {
		return getAlbumDAO().addNewAlbumToDefaultFolder(pMemberId, pAlbumName);
	}

	public boolean deleteAlbum(Long pMemberId, Long pAlbumId) {
		return getAlbumDAO().deleteAlbum(pMemberId, pAlbumId);
	}

	public boolean editAlbumName(Long pMemberId, Long pAlbumId,	String pAlbumName) {
		return getAlbumDAO().editAlbumName(pMemberId, pAlbumId, pAlbumName);
	}

	public boolean addSongToAlbum(Long pMemberId, Long pAlbumId, Long pSongId) {
		return getAlbumDAO().addSongToAlbum(pMemberId, pAlbumId, pSongId);
	}

	public boolean checkMemberPermissionForAlbum(Long pMemberId, Long pAlbumId) {
		return getAlbumDAO().checkMemberPermissionForAlbum(pMemberId, pAlbumId);
	}

	public boolean deleteSongFromAlbum(Long pMemberId, Long pAlbumId,Long pSongId) throws AlbumPermissionDeniedException {
		return getAlbumDAO().deleteSongFromAlbum(pMemberId, pAlbumId, pSongId);
	}
	public List<Album> getDefaultAlbums(Long pMemberId) {
		return getAlbumDAO().getDefaultAlbums(pMemberId);
	}
}
